package leetcode.code1833;

import java.util.Arrays;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution implements IDebug {

	public int maxIceCream(int[] costs, int coins) {
		Arrays.sort(costs);
		int i = 0;
		while (i < costs.length && coins >= costs[i]) {
			coins -= costs[i];
			i++;
		}
		return i;
	}

	@Override
	public void debug4() {
		H.compare(9, this.maxIceCream(H.str2array3("[7,3,3,6,6,6,10,5,9,2]"), 56));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
